package com.stylefeng.guns.modular.system.controller;

import com.stylefeng.guns.common.controller.BaseController;
import com.stylefeng.guns.common.persistence.dao.LunbopicMapper;
import com.stylefeng.guns.common.persistence.model.Lunbopic;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

/**
 * 轮播表控制器
 *
 * @author fengshuonan
 * @Date 2019-01-08 16:06:16
 */
@Controller
@RequestMapping("/lunbopic")
public class LunbopicController extends BaseController {

    private String PREFIX = "/system/lunbopic/";

    @Autowired
    LunbopicMapper lunbopicMapper;

    /**
     * 跳转到轮播表首页
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "lunbopic.html";
    }

    /**
     * 跳转到添加轮播表
     */
    @RequestMapping("/lunbopic_add")
    public String lunbopicAdd() {
        return PREFIX + "lunbopic_add.html";
    }

    /**
     * 跳转到修改轮播表
     */
    @RequestMapping("/lunbopic_update/{lunbopicId}")
    public String lunbopicUpdate(@PathVariable Integer lunbopicId, Model model) {
        return PREFIX + "lunbopic_edit.html";
    }

    /**
     * 获取轮播表列表
     */
    @RequestMapping(value = "/list")
    @ResponseBody
    public Object list(String condition) {
        List<Lunbopic> lunbopics = lunbopicMapper.selectList(null);
        return lunbopics;
    }

    /**
     * 新增轮播表
     */
    @RequestMapping(value = "/add")
    @ResponseBody
    public Object add() {
        return super.SUCCESS_TIP;
    }

    /**
     * 删除轮播表
     */
    @RequestMapping(value = "/delete")
    @ResponseBody
    public Object delete() {
        return SUCCESS_TIP;
    }


    /**
     * 修改轮播表
     */
    @RequestMapping(value = "/update")
    @ResponseBody
    public Object update() {
        return super.SUCCESS_TIP;
    }

    /**
     * 轮播表详情
     */
    @RequestMapping(value = "/detail")
    @ResponseBody
    public Object detail() {
        return null;
    }
}
